package edu.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.core.StringUtil;
import edu.dao.BaseDao;
import edu.entity.Notice;
import edu.entity.Role;

@Service("roleService")
public class RoleService extends BaseService {
	@Autowired
	private BaseDao baseDao;
	
    public void insertRole(Role role) throws Exception {
    	if(role!=null){
    		baseDao.insert(role);
    	}
    }
    
    public void updatetRole(Role role) throws Exception {
    	if(role!=null){
    		baseDao.update(role);
    	}
    }
    
    public void deleteRole(Role role) throws Exception {
    	if(role!=null){
    		baseDao.delete(role);
    	}
    }
    
    public void deleteRoleById(String id) throws Exception {
    	if(StringUtil.isNotEmpty(id)){
    		baseDao.deleteById(Role.class, id);
    	}
    }
    
    public Role selectRoleById(String id) throws Exception {
    	Role role = null;
    	if(StringUtil.isNotEmpty(id)){
    		role = (Role)baseDao.selectObjById(Notice.class, id);
    	}
    	return role;
    }
}
